package com.it.bannner.dao

import androidx.room.*
import com.it.bannner.common.DownRecor


/**
 * dao层
 */
@Dao
interface DownDao {
    // 因为这个方法被标记为了 suspend，Room 将会在保证主线程安全的前提下使用自己的调度器来运行这个查询
    @Query("SELECT * FROM downrecor where downed =1")
    suspend fun queryList(): List<DownRecor>


    @Query("select * from downrecor where name = (:name)")
    suspend fun queryListByName(name: String): DownRecor


    /**
     * vararg可变参数
     */
    @Insert
    suspend fun addRecord(vararg recor: DownRecor)

    @Delete
    suspend fun deleteRecord(vararg recor: DownRecor)

    @Update
    suspend fun updateRecord(vararg recor: DownRecor)


    @Query("DELETE FROM downrecor")
     suspend fun deleteAll()

}